package com.demoworld;

import com.demoworld.dao.CustomMapperFactory;
import com.demoworld.dao.IBankDao;
import com.demoworld.dao.IUserDao;
import com.demoworld.entity.User;
import com.demoworld.entity.UserBankAccountInfo;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

import java.io.IOException;
import java.io.Reader;
import java.math.BigDecimal;
import java.util.UUID;

/**
 * Created by francis on 2017/6/14.
 */
public class main {
@Test
public void addUser() throws IOException {
    User user = new User();
    user.setId(UUID.randomUUID().toString());
    user.setName("Jim");
    user.setSex("男");
    IUserDao mapper = CustomMapperFactory.User.createMapper(IUserDao.class);
    mapper.add(user);
}

@Test
public void addBankInfo() throws IOException {
    UserBankAccountInfo tmpBankInfo = new UserBankAccountInfo();
    tmpBankInfo.setUserid(UUID.randomUUID().toString());
    tmpBankInfo.setUsername("Jim");
    tmpBankInfo.setBalance(new BigDecimal("1266584.3658"));
    IBankDao mapper = CustomMapperFactory.Bank.createMapper(IBankDao.class);
    mapper.add(tmpBankInfo);
}
}
